select {
	background: var(--contentBg);
	border: 1px solid var(--border);
	border-radius: 4px;
	color: var(--color);
}

.login-footer {
	color: var(--color);
}

.content-footer {
	width: 100%;
	padding: @padding-large;
	max-width: 840px;
	margin-bottom: 16px;
	background-color: var(--contentBg);
	border: 1px solid var(--border);
	display: flex;
	flex-flow: column;
	align-items: center;

	@media @display-mode-pwa {
		padding-bottom: calc(@padding-large + env(safe-area-inset-bottom));
	}
}

.metadata {
	display: flex;
	flex-flow: row wrap;
	text-align: center;
	font-size: 16px;
	color: var(--colorLink);
	&:nth-child(1) {
		justify-content: flex-start;
	}

	&:nth-child(2) {
		justify-content: flex-end;
	}

	&[v-cloak] {
		visibility: hidden;
	}
}

.links {
	display: flex;
	flex-flow: row wrap;

	a {
		padding: 0 4px;
		color: var(--color);
		text-decoration: underline;

		&:hover,
		&:focus {
			color: var(--main);
		}
	}
}

* {
	border-width: 0;
	box-sizing: border-box;
	font-family: "Source Sans Pro", sans-serif;
	margin: 0;
	padding: 0;
	text-decoration: none;
}

body {
	background-color: var(--bg);
}

a {
	cursor: pointer;
}

.spacer {
	flex: 1;
}

#login-scene {
	height: 100%;
	height: 100dvh;
	padding: 16px;
	overflow: auto;
	display: flex;
	align-items: center;
	flex-flow: column nowrap;
	background-color: var(--bg);

	> .error-message {
		width: 100%;
		max-width: 400px;
		font-size: 1em;
		background-color: var(--contentBg);
		border: 1px solid var(--border);
		padding: 16px;
		margin-top: auto;
		margin-bottom: 16px;
		text-align: center;
		color: var(--errorColor);
	}

	#login-box {
		width: 100%;
		max-width: 400px;
		margin-bottom: auto;
		background-color: var(--contentBg);
		display: flex;
		flex-flow: column nowrap;
		border: 1px solid var(--border);
		flex-shrink: 0;

		&:first-child {
			margin-top: auto;
		}

		#logo-area {
			display: flex;
			align-items: center;
			flex-flow: column nowrap;
			padding: 16px;
			background-color: var(--main);
			border-bottom: 1px solid var(--border);
			flex-shrink: 0;

			#logo {
				font-size: 3em;
				font-weight: 100;
				color: var(--contentBg);

				span {
					margin-right: 8px;
				}
			}

			#tagline {
				font-weight: 500;
				margin-top: 4px;
				color: var(--contentBg);
				text-align: center;
			}
		}

		#input-area {
			padding: 16px;
			display: grid;
			grid-gap: 16px;
			grid-template-columns: auto 1fr;
			justify-content: baseline;
			align-items: center;
			border-bottom: 1px solid var(--border);

			> label {
				color: var(--color);
			}

			> input {
				color: var(--color);
				padding: 8px;
				background-color: var(--contentBg);
				border: 1px solid var(--border);
				min-width: 0;
				font-size: 1em;
			}

			.checkbox-field {
				grid-column: 1 / span 2;
				display: flex;
				flex-flow: row nowrap;
				align-items: center;
				justify-content: center;
				cursor: pointer;

				&:hover,
				&:focus {
					text-decoration: underline;
					text-decoration-color: var(--main);
				}

				> input[type="checkbox"] {
					margin-right: 8px;
				}
			}
		}

		#button-area {
			display: flex;
			flex-flow: row nowrap;
			padding: 16px;
			justify-content: center;

			a {
				color: var(--color);
				text-transform: uppercase;
				text-align: center;
				font-weight: 600;
				cursor: default;

				&.button {
					cursor: pointer;

					&:hover,
					&:focus {
						color: var(--main);
					}
				}
			}
		}
	}
}

#main-scene {
	min-height: 100%;
	min-height: 100dvh;
	padding-top: @header-height-desktop;
	padding-left: @sidebar-width;
	background-color: var(--bg);

	@media @display-mode-pwa {
		padding-bottom: env(safe-area-inset-bottom);
	}

	#main-sidebar {
		top: 0;
		left: 0;
		width: @sidebar-width;
		height: 100%;
		height: 100dvh;
		position: fixed;
		display: flex;
		flex-flow: column nowrap;
		background-color: var(--sidebarBg);
		z-index: 1;

		a {
			flex-shrink: 0;
			display: block;
			width: @sidebar-width;
			line-height: @sidebar-height-desktop;
			text-align: center;
			font-size: 1em;
			color: var(--colorSidebar);

			&.active {
				cursor: default;
				color: var(--colorSidebar);
				background-color: var(--main);
			}

			&:hover,
			&:focus {
				color: var(--main);
				background-color: var(--sidebarHoverBg);
			}
		}
	}

	.page-header {
		top: 0px;
		left: @sidebar-width;
		right: 0px;
		height: @header-height-desktop;
		position: fixed;
		color: var(--color);
		background-color: var(--headerBg);
		border-bottom: 1px solid var(--border);
		padding: 0 @padding-standard;
		z-index: 10;
	}

	h1.page-header {
		line-height: @header-height-desktop;
		font-size: 1.3em;
		font-weight: 600;
	}

	div.page-header {
		display: flex;
		flex-flow: row nowrap;
		align-items: center;

		p {
			flex: 1 0;
			font-size: 1.3em;
			font-weight: 600;
			line-height: @header-height-desktop;
			color: var(--color);
		}

		input[type="text"] {
			flex: 1 0;
			min-width: 0;
			margin-right: @padding-small;
			font-size: 1.1em;
			font-weight: 500;
			line-height: calc(@header-height-desktop - 1px);
			color: var(--color);
			background-color: var(--contentBg);

			&::placeholder {
				color: var(--colorLink);
			}
		}

		a {
			display: block;
			width: 24px;
			line-height: 24px;
			color: var(--colorLink);
			text-align: center;

			&:not(:last-child) {
				margin-right: @padding-small;
			}

			&:hover {
				color: var(--main);
			}
		}
	}

	.loading-overlay {
		display: flex;
		flex-flow: column nowrap;
		align-items: center;
		justify-content: center;
		overflow: hidden;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		width: 100dvw;
		height: 100%;
		height: 100dvh;
		z-index: 10001;
		background-color: rgba(0, 0, 0, 0.6);

		i {
			color: var(--colorSidebar);
			font-size: 4em;
			text-align: center;
			width: 80px;
			line-height: 80px;
			position: absolute;
		}
	}

	@media (max-width: @screen-sm-max) {
		padding-top: @header-height-mobile;
		padding-left: 0;
		padding-bottom: @sidebar-height-mobile;

		#main-sidebar {
			top: auto;
			right: 0;
			bottom: 0;
			width: 100%;
			width: 100dvw;
			height: @sidebar-height-mobile;
			flex-flow: row nowrap;
			border-top: 1px solid var(--border);

			@media @display-mode-pwa {
				height: calc(@sidebar-height-mobile + @inlet-bottom);
			}

			.spacer {
				display: none;
			}

			a {
				width: auto;
				flex: 1 0;
				line-height: @sidebar-height-mobile;

				&:hover,
				&:focus {
					color: var(--colorSidebar);
					background-color: var(--main);
				}
			}
		}

		.page-header {
			left: 0;
			height: @header-height-mobile;
		}

		h1.page-header {
			text-align: center;
			font-size: 1em;
			line-height: @header-height-mobile;
			text-transform: uppercase;
		}

		div.page-header {
			flex-flow: row wrap;

			p {
				flex: 1 0;
				font-size: 1em;
				font-weight: 500;
				line-height: 3em;
				padding: 0;
			}

			input[type="text"] {
				flex: 1 0;
				font-size: 1em;
				font-weight: 500;
				line-height: 3em;
			}

			a {
				display: block;
				width: 24px;
				line-height: 100%;
			}
		}
	}
}

#content-scene {
	padding: 20px;
	display: flex;
	color: var(--color);
	background-color: var(--bg);
	flex-flow: column nowrap;
	align-items: center;

	#header {
		width: 100%;
		padding: 20px;
		max-width: 840px;
		margin-bottom: 16px;
		background-color: var(--contentBg);
		border: 1px solid var(--border);
		display: flex;
		flex-flow: column;
		align-items: center;

		#title {
			padding: 8px 0;
			grid-column-start: 1;
			grid-column-end: -1;
			font-size: 36px;
			font-weight: 700;
			word-break: break-word;
			hyphens: none;
			text-align: center;
		}
	}

	#content {
		width: 100%;
		padding: 20px;
		max-width: 840px;
		background-color: var(--contentBg);
		border: 1px solid var(--border);

		* {
			font-size: 18px;
			line-height: 180%;

			&:not(:last-child) {
				margin-bottom: 20px;
			}
		}

		a {
			color: var(--color);
			text-decoration: underline;

			&:hover,
			&:focus {
				color: var(--main);
			}
		}

		pre,
		code {
			overflow: auto;
			border: 1px solid var(--border);
			font-family: "Ubuntu Mono", "Courier New", Courier, monospace;
			font-size: 16px;
		}

		pre {
			padding: 8px;

			> code {
				border: 0;
			}
		}

		ol,
		ul {
			padding-left: 16px;
		}

		img {
			height: auto;
			max-width: 100%;
		}

		table {
			border: 1px solid var(--border);
			border-collapse: collapse;

			tr,
			th,
			td {
				border: 1px solid var(--border);
			}
		}
		blockquote {
			margin: 15px;
			padding: 15px;
			font-style: italic;
			background: var(--bgqoute);
		}
	}
}

#page-home {
	> .empty-message {
		max-width: 400px;
		font-size: 1em;
		background-color: var(--contentBg);
		border: 1px solid var(--border);
		padding: 16px;
		margin: 16px;
		color: var(--errorColor);
	}

	#edit-box {
		background-color: var(--selectedBg);
		border-bottom: 1px solid var(--main);
	}

	#bookmarks-grid {
		display: grid;
		grid-template-rows: min-content;
		grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
		grid-gap: 16px;
		padding: 16px;
		overflow: auto;

		.bookmark {
			align-self: start;
		}

		.pagination-box {
			grid-column-end: -1;
			grid-column-start: 1;
			display: flex;
			flex-flow: row nowrap;
			align-self: start;

			a {
				padding: 8px;
				color: var(--colorLink);

				&:hover,
				&:focus {
					color: var(--main);
				}
			}

			input {
				width: 40px;
				padding: 8px;
				text-align: center;
				font-size: 0.9em;
				color: var(--color);
				border: 1px solid var(--border);
				background-color: var(--contentBg);
				margin: 0 8px;
			}

			p {
				font-size: 0.9em;
				color: var(--colorLink);
				line-height: 37px;
				font-weight: 600;

				&:last-of-type::before {
					content: "/";
					margin-right: 8px;
				}
			}
		}

		&.list {
			grid-gap: 0;
			padding-bottom: 0;
			grid-template-columns: auto;

			.pagination-box {
				padding: 16px 0;

				&:first-child {
					padding-top: 0;
				}
			}

			@media (max-width: 600px) {
				padding: 16px 0 0;

				.pagination-box {
					padding: 16px;
				}
			}
		}
	}

	#dialog-tags {
		.custom-dialog-body {
			grid-template-columns: repeat(2, minmax(0, 1fr));

			@media (max-width: 600px) {
				grid-template-columns: minmax(0, 1fr);
			}

			a {
				font-size: 1em;
				color: var(--color);

				span {
					&:last-child {
						font-size: 1em;
						color: var(--colorLink);
						margin-left: 4px;

						&::before {
							content: "(";
							margin-right: 2px;
						}

						&::after {
							content: ")";
							margin-left: 2px;
						}
					}
				}

				&:hover,
				&:focus {
					color: var(--main);
				}
			}
		}
	}
}

#page-setting {
	min-height: 0;
	max-height: 100%;
	display: flex;
	flex-flow: column nowrap;

	.setting-container {
		padding: 8px;
		display: flex;
		overflow: auto;
		flex-flow: column nowrap;
		flex: 1 0;

		&::after {
			content: "";
			display: block;
			min-height: 1px;
		}

		details.setting-group {
			margin: 8px;
			display: block;
			max-width: 350px;
			color: var(--color);
			background-color: var(--contentBg);
			border: 1px solid var(--border);

			@media (max-width: 600px) {
				max-width: 100%;
			}

			summary {
				list-style: none;
				font-weight: 600;
				width: 100%;
				padding: 12px 8px;
				font-size: 1.1em;

				cursor: pointer;

				&:hover {
					color: var(--main);
				}

				&::-webkit-details-marker {
					display: none;
				}

				&::after {
					content: "+";
					margin-left: 8px;
					font-weight: 600;
				}
			}

			&[open] summary {
				border-bottom: 1px solid var(--border);

				&::after {
					content: "-" !important;
				}
			}

			ul {
				list-style: none;

				li {
					padding: 4px 8px;
					color: var(--color);
					display: flex;
					flex-flow: row nowrap;
					align-items: center;
				}
			}

			div.setting-group-footer {
				padding: 4px 8px;
				display: flex;
				flex-flow: column nowrap;
				align-items: flex-end;
				border-top: 1px solid var(--border);

				> a {
					text-transform: uppercase;
					padding: 8px 4px;
					font-size: 0.9em;
					font-weight: 600;

					&:hover {
						color: var(--main);
					}

					&:focus {
						outline: none;
						color: var(--main);
						border-bottom: 1px dashed var(--main);
					}
				}
			}
		}
	}

	#setting-display,
	#setting-bookmarks {
		display: flex;
		flex-flow: column nowrap;

		&[open] {
			padding-bottom: 8px;

			summary {
				margin-bottom: 8px;
			}
		}

		label {
			padding: 4px 8px;
			color: var(--color);
			display: flex;
			flex-flow: row nowrap;
			align-items: center;
			cursor: pointer;

			&:hover,
			&:focus {
				text-decoration: underline;
				text-decoration-color: var(--main);
			}

			> input[type="checkbox"] {
				margin-right: 8px;
			}
		}
	}

	.setting-accounts {
		summary {
			margin-bottom: 0;
		}

		ul {
			list-style: none;

			li {
				padding: 8px;
				display: flex;
				flex-flow: row nowrap;
				align-items: center;

				&:not(:last-child) {
					border-bottom: 1px solid var(--border);
				}

				p {
					font-size: 1em;
					color: var(--color);
					flex: 1 0;

					span {
						color: var(--colorLink);
					}
				}

				a {
					margin-left: 8px;
					color: var(--colorLink);

					&:hover {
						color: var(--main);
					}
				}
			}
		}
	}

	#setting-system-info {
		ul {
			padding-top: 4px;
			padding-bottom: 4px;

			li {
				span {
					margin-left: 8px;
				}
			}
		}
	}
}
